const http = require('http');

const server = http.createServer((req, res) => {
  res.writeHead(200, { 'Content-Type': 'application/json' });
  
  if (req.url === '/') {
    res.end(JSON.stringify({
      success: true,
      message: '美食+游玩后端服务运行中',
      version: '1.0.0',
      timestamp: new Date().toISOString()
    }));
  } else if (req.url === '/health') {
    res.end(JSON.stringify({
      success: true,
      status: 'healthy',
      uptime: process.uptime(),
      memory: process.memoryUsage()
    }));
  } else {
    res.writeHead(404);
    res.end(JSON.stringify({
      success: false,
      message: 'Not Found'
    }));
  }
});

const PORT = process.env.PORT || 7001;
server.listen(PORT, () => {
  console.log(`🚀 服务已启动在 http://localhost:${PORT}`);
  console.log(`📋 健康检查: http://localhost:${PORT}/health`);
  console.log(`📖 完整功能需要等待 npm install 完成后使用 npm run dev`);
});